import axios from "axios";
import { message } from "ant-design-vue";

//python端请求
const flask = axios.create({
    baseURL: '/flask',
    timeout: 5000,
    responseType: 'json',
    headers:{
        'Content-Type': 'application/json;charset=UTF-8',
    }
})
//请求拦截器
flask.interceptors.request.use(
    (res) => {

        return res
    },
    (err) => {
        //请求失败

        return Promise.reject(err)
    }
)
//响应拦截器
flask.interceptors.response.use(
    (response)=>{
        //响应成功，响应体设置

        return response.data
    },
    (error)=>{
        //响应识别

        return Promise.reject(error)
    }
)
//导出
export default flask